home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
COMMUNIC
/
1024.ZIP
/
GT-RENEW.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-10-24
|
2KB
|
56 lines
/*
This program may be used to 'freshen' your GT POWER directory. You
normally get only 150 uses of GT.COM, at which point your directory
becomes useless. The aging process takes place only within GT.DIR,
so you may always copy a previously saved version of GT.DIR, but you
will then lose all changes since made to the directory. By running
this program occasionally, you will restore youth to GT.DIR, and not
lose anything in the process. GT-RENEW is small and fast enough so
that you may want to run it from a batch file each time you run GT.
*/
#include "fcntl.h"
#define BUFFER_LENGTH 133
#define TO_DOS_HAPPILY 0
#define TO_DOS_WITH_TAIL_TUCKED_BETWEEN_LEGS 1
main()
{
int fh;
char *filename = "gt.dir";
int filemode = O_RDWR | O_RAW;
char buffer[ BUFFER_LENGTH ];
printf("\n**** GT RE-NEW ( for GT POWER 13.xx ");
printf("and similar versions ) ****\n");
fh = open( filename, filemode, 0 );
if ( fh < 0 )
{
printf("\n**** ERROR: Can't access '%s' ****\n", filename );
exit( TO_DOS_WITH_TAIL_TUCKED_BETWEEN_LEGS );
}
if ( read( fh, buffer, BUFFER_LENGTH ) < BUFFER_LENGTH )
{
printf("\n**** ERROR: '%s' has been truncated ****\n", filename );
exit( TO_DOS_WITH_TAIL_TUCKED_BETWEEN_LEGS );
}
buffer[ 001 ] = 0x93;
buffer[ 130 ] = 0x63;
buffer[ 132 ] = 0x6c;
lseek( fh, 0L, 0 );
if ( write( fh, buffer, BUFFER_LENGTH ) < BUFFER_LENGTH )
{
printf("\n**** ERROR: Can't write to '%s' properly ****", filename );
exit( TO_DOS_WITH_TAIL_TUCKED_BETWEEN_LEGS );
}
close( fh );
printf(" DONE\n");
exit( TO_DOS_HAPPILY );
}